<template>
  <div>
    <div class="wrapper">
      <section class="step step2">
        <p>{{ type === '1' ? '充值漫币' : '提现漫币'}}</p>
        <div class="stepContent">
          <div class="inputBox">
            <input class="inputC" v-model="subObject.total" :placeholder="`请输入所要${type === '1' ? '充值' : '提现'}的漫币`" />
          </div>
        </div>
        <div class="descripe">1元 = 100漫币 </div>
        <div class="stepControll" @click="submitTask()">确认{{type === '1' ? '充值' : '提现'}}</div>
      </section>
    </div>
  </div>
</template>

<script>
import { mineApi } from '@/api'
import { XInput } from 'vux'
export default {
  components: {
    XInput
  },
  async created() {
    this.type = this.$route.query.type
    if (this.$route.query.id) {
      const res = await mineApi.getBank({
        pageNo: 1,
        pageSize: 100
      })
      if (res.data && res.data.records[0]) {
        this.subObject = res.data.records[0]
      }
    }
  },
  data() {
    return {
      topResource: {
        centerCont: ''
      },
      type: '1',
      subObject: {
        nonceStr: new Date().getTime()
      },
      inviteCode: '',
      inviteInfo: {}
    }
  },
  methods: {
    async submitTask() {
      let res = ''
      console.log('res', res)
      if (this.type === '2') {
        res = await mineApi.addWithdraw(this.subObject)
      } else {
        res = await mineApi.addRecharge(this.subObject)
      }
      if (res.code !== 200) {
        return
      }
      this.$toast('操作成功')
    }
  }
}
</script>

<style rel="stylesheet/scss" lang="scss" scoped>
@import "src/assets/css/mixin.scss";
@import 'src/assets/css/variables.scss';
  .wrapper {
    position: relative;
    left: 0;
    top: 0;
    // background: #fff;
    width: 100%;
    /*background-color: #000;*/
  }
  .step{
    padding: 10px 0;
    p{
      text-align: center;
      font-size: 18px;
      margin-bottom: 20px;
    }
    .line{
      line-height: 24px;
    }
    .color-theme{
      color: $color-theme;
    }
    .inputBox{

      display: flex;
      .yanzheng{
        background-color: $color-theme;
        line-height: 35px;
        height: 35px;
        text-align: center;
        border-radius: 20px;
        color: white;
        width: 80px;
      }
    }
    .descripe{
      color: #909090;
      padding: 10px;
    }
  }
  .stepContent{
    background: #fff;
    .inputBox{
      margin-bottom: 10px;
      font-size: 15px;
      .inputC{
        width: 100%;
        line-height: 50px;
        padding: 0 10px;
        outline: none;
        // border: 1px solid #ccc;
      }
    }
  }
  .imgBox{
    display: flex;
    width: 100%;
    flex-wrap: wrap;
    .imgItem{
      flex: 0 0 33%;
      padding-top: 33%;
      position: relative;
      .pis{
        width: 20px;
        height: 20px;
        position: absolute;
        left: 80%;
        z-index: 2;
        top: 0;
      }
      img{
        position: absolute;
        left: 10%;
        top: 10%;
        width: 80%;
        height: 80%;
      }
      &:nth-last-child(1) {
        margin-right: 0;
      }
    }
  }
  .stepControll{
    font-size: 16px;
    color: white;
    margin: 0;
    /* background: -webkit-linear-gradient(left, #A38456, #CABA96); */
    background-color: $color-theme;
    line-height: 41px;
    text-align: center;
    border-radius: 20px;
    margin-top: 10%;
    width: 80%;
    margin-left: 10%;
  }
</style>
